<?php
defined( '_JEXEC' ) or die( 'Restricted Access' );
/**
 * @version     $Id$
 * @package     Virtuemart
 * @subpackage  GoodRelations Module
 * @copyright   Copyright (C) 2012 Alex Stolz - All rights reserved.
 * @license     LGPL
 */

/*
Originally taken from http://www.karlrixon.co.uk/writing/find-the-system-temp-directory-with-php/
*/
if (!function_exists('sys_get_temp_dir')) {
    function sys_get_temp_dir() {
        foreach (array('TMP', 'TEMP', 'TMPDIR') as $env_var) {
            if ($temp = getenv($env_var)) {
                return $temp;
            }
        }
        $temp = tempnam(__FILE__, '');
        if (file_exists($temp)) {
            unlink($temp);
            return dirname($temp);
        }
        return null;
    }
}
?>